% Analysis of max OD, which generates the maximum calibrated OD within a
% given time windows specified


%% Glucose analysis
max_time_glucose = 60; % Max time (hours)
index_glucose = [1:6 (1:6)+12 (1:6)+24]'; % Index vector of well positions

maxODc_glucose = [];

for k=1:length(index_glucose)
    ODc = sampleplate(index_glucose(k)).OD600_blanked;
    time = sampleplate(index_glucose(k)).time;
    maxODc = max(ODc(time<max_time_glucose));
    
    maxODc_glucose(k) = maxODc;
end
    
maxODc_glucose = reshape(maxODc_glucose',6,3);
    

%% Succinate analysis
max_time_succinate = 80; % Max time (hours)
index_succinate = [37:42 (37:42)+12 (37:42)+24]'; % Index vector of well positions

maxODc_succinate = [];

for k=1:length(index_succinate)
    ODc = sampleplate(index_succinate(k)).OD600_blanked;
    time = sampleplate(index_succinate(k)).time;
    maxODc = max(ODc(time<max_time_succinate));
    
    maxODc_succinate(k) = maxODc;
end
    
maxODc_succinate = reshape(maxODc_succinate',6,3);

%% acetate analysis
max_time_acetate = 150; % Max time (hours)
index_acetate = [73:78 (73:78)+12 7:12]'; % Index vector of well positions

maxODc_acetate = [];

for k=1:length(index_acetate)
    ODc = sampleplate(index_acetate(k)).OD600_blanked;
    time = sampleplate(index_acetate(k)).time;
    maxODc = max(ODc(time<max_time_acetate));
    
    maxODc_acetate(k) = maxODc;
end
    
maxODc_acetate = reshape(maxODc_acetate',6,3);
    
%% LB analysis
max_time_LB = 50; % Max time (hours)
index_LB = [19:24 (19:24)+12 (19:24)+24]'; % Index vector of well positions

maxODc_LB = [];

for k=1:length(index_LB)
    ODc = sampleplate(index_LB(k)).OD600_blanked;
    time = sampleplate(index_LB(k)).time;
    maxODc = max(ODc(time<max_time_LB));
    
    maxODc_LB(k) = maxODc;
end
    
maxODc_LB = reshape(maxODc_LB',6,3);

%% NZCasePlus analysis
max_time_NZCasePlus = 100; % Max time (hours)
index_NZCasePlus = [55:60 (55:60)+12 (55:60)+24]'; % Index vector of well positions

maxODc_NZCasePlus = [];

for k=1:length(index_NZCasePlus)
    ODc = sampleplate(index_NZCasePlus(k)).OD600_blanked;
    time = sampleplate(index_NZCasePlus(k)).time;
    maxODc = max(ODc(time<max_time_NZCasePlus));
    
    maxODc_NZCasePlus(k) = maxODc;
end
    
maxODc_NZCasePlus = reshape(maxODc_NZCasePlus',6,3);
    